/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/phone/SpipcHandler.h,v 1.11 2003/11/21 16:12:58 itsme Exp $
 *
 *
 */


#ifndef __SPIPCHANDLER_H_

#include "vectorutils.h"
#include "stringutils.h"
#include <string>

class CCPhoneDlg;

class SpipcHandler {
public:
    SpipcHandler(CCPhoneDlg& dlg);
    ~SpipcHandler();

    bool DoHangup();
    bool DoMakeCall();
    bool DoPickup();
    bool DoReject();

    void SetConfiguration(int cfgtype);

    void UpdateLastCaller(const std::string& nr);
    bool SetMachineKey(ByteVector keydata, bool bOriginating);

    bool Init();
    bool Stop();
    bool HandleMessage(DWORD lParam, DWORD wParam);

    bool MuteVoice();
    bool UnmuteVoice();

    bool DisableVoiceCodec();
    bool EnableVoiceCodec();

    bool SetVolume(DWORD volume);
    bool RequestVolume();

    bool Hangup();
    bool Answer();
    bool Dial_Digital(const std::string& number);
    bool Dial_Analog(const std::string& number);

    bool HangupKeyPressed();
    bool AnswerKeyPressed();
    bool CallButtonPressed();
    bool HeadsetKeyPressed();

    enum CallDirection {
        CALLDIR_ORIGINATING= 1,
        CALLDIR_NOCALL     = 0,
        CALLDIR_RECEIVING  =-1
    };

    bool TestForOrRestartMachine();

private:
        CCPhoneDlg& m_dlg;

        int m_nRingCount;
        bool m_bGotCallerid;
};

#define __SPIPCHANDLER_H_
#endif
